﻿using System;
using System.Collections.Generic;
using System.IO;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using YArchitech.Revit;

namespace YArchitech.HVAC
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class TestIndependentCommond : HYNoTranExternalCommand
	{
		public override void FilterProcess()
		{
            base.FilterViewType.Add((ViewType)4);
			base.FilterProcess();
		}

		public override Result HYExecute()
		{
			Transaction transaction = new Transaction(base.Doc, "添加共享参数");
			string text = "E:\\SVN-Res\\Install\\HYRevit\\Data\\MarkTagShareParam.txt";
			if (!File.Exists(text))
			{
				return Autodesk.Revit.UI.Result.Cancelled;
			}
			string gropeName = "管道标记";
			List<string> list = new List<string>();
			list.Add("分隔符");
			CategorySet categorySet = base.UiApp.Application.Create.NewCategorySet();
			transaction.Start();
			Category category = base.UiApp.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_IOSDetailGroups);
			categorySet.Insert(category);
			YJKRevitTools.SetInstanceParameter(base.UiApp, text, gropeName, list, categorySet, false, BuiltInParameterGroup.PG_IDENTITY_DATA);
			transaction.Commit();
			return Autodesk.Revit.UI.Result.Succeeded;
		}
	}
}
